﻿using System.Collections.Generic;
using System.ComponentModel;
using GIMS.Def.Arguments;
using GIMS.Def.Flags;
using GIMS.Def.Settings;

namespace GIMS.Def.Operators
{
    public class CropOperator : Operator
    {
        private static GeometryType possibleGeometryTypes = GeometryType.widthxheight | GeometryType.offsetNeeded;
        private GravitySetting gravitySetting;

        public CropOperator()
        {
            name = "Crop";
            description = "Crops the given image";
            instruction = "-crop";
            iconPath = @"Images\crop.png";
            argument = new GeometryArgument(possibleGeometryTypes, GeometryType.widthxheight | GeometryType.offsetNeeded);
            possiblePrograms = Program.convert | Program.mogrify;
            position = Position.Between;
            gravitySetting = new GravitySetting();
            gravitySetting.Description = "Defines the position of the offset-nullpoint";
            settings = new List<Setting>{gravitySetting};

            argument.PropertyChanged += new PropertyChangedEventHandler(OnArgumentChanged);
            gravitySetting.Argument.PropertyChanged += new PropertyChangedEventHandler(OnArgumentChanged);
            gravitySetting.PropertyChanged += new PropertyChangedEventHandler(OnSettingChanged);

            GeometryArgument gArg= (GeometryArgument) argument;
            gArg.Width = 50;
            gArg.Height = 50;

        }
    }
}
